<template>
  <div class="mobilehome">
    <el-carousel trigger="click">
      <el-carousel-item v-for="(item, key) in mobilebanner" :key="key" :style="{backgroundImage: 'url(' + item.src + ')'}" />
    </el-carousel>
    <el-row type="flex" class="common-bg" justify="space-between">
      <el-col
        v-for="(node, index) in menu"
        :key="index"
        :span="6"
      >
        <div class="common-btn" @click="click">
          <div class="common-icon"><img :src="require('@assets/image/common_btn.jpg')"></div>
          <div class="common-title">{{ node.name }}</div>
        </div>
      </el-col>
    </el-row>
    <div v-for="(item, key) in menu" :key="key" class="allbtn_bg">
      <div class="allbtn_top">{{ item.name }}</div>
      <el-row type="flex" class="allbtn-list">
        <el-col
          v-for="(node, index) in item.children"
          :key="index"
          :span="8"
        >
          <div class="allbtn-title" @click="$emit('nodeClick',node,$event)"><i class="el-icon-share" />{{ node.name }}</div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
export default {
  name: 'MoblieHome',
  data() {
    return {
      // 轮播图片
      mobilebanner: [
        { src: require('@assets/image/mobile_banner.jpg') },
        { src: require('@assets/image/mobile_banner.jpg') }
      ]
    }
  },
  computed: {
    ...mapState({
      user: state => state.authentication.data,
      menu: state => state.menu
    })
  },
  created() {
    this.initData()
  },
  methods: {
    ...mapActions([
    ]),
    initData() {
    }
  }
}
</script>
<style>
body {
  /* background-image: none; */
  background-color: #eeeeee;
}
.el-carousel__container {
  height: 12rem;
}
.el-carousel__item {
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}
</style>
<style scoped>
/* .mobilehome { */
  /* width: 100%;
  height: 100vh;
  overflow: auto; */
/* } */
.common-bg {
  padding: 1rem;
  padding-bottom: 0;
  flex-wrap: wrap;
  background-color:#fff;
  border-bottom: solid 1px #cdcdcd;
  text-align: center;
}
.common-btn {
  padding-bottom: 1rem;
}
.common-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto;
  border-radius: 50%;
  background-color:#168989;
  overflow: hidden;
}
.common-icon img {
  width: 100%;
  height: auto;
}
.common-title {
  padding-top: .4rem;
  color:#168989;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.allbtn_bg {
  margin-top: .5rem;
  background-color: #fff;
  border-top: solid 1px #cdcdcd;
  border-bottom: solid 1px #cdcdcd;
}
.allbtn_top {
  padding-left: .5rem;
  border-left: solid 5px #17898a;
  border-bottom: solid 1px #cdcdcd;
  font-size: 1.6rem ;
  color: #17898a;
  line-height: 3rem;
}
.allbtn-list {
  padding: .5rem 1rem;
  flex-wrap: wrap;
}
.allbtn-title {
  padding: .5rem 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  color: #666;
}
.allbtn-title > i {
  margin-right: .2rem;
  font-size: 1.6rem ;
  color: #168989;
}
</style>
